package com.ht.job;

import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import javax.annotation.Resource;
import java.util.Date;

@PersistJobDataAfterExecution//将jobDataMap进行持久化
@DisallowConcurrentExecution//禁止并发
public class QuartzJob extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        String jobKey = jobDataMap.getString("jobKey");
        System.out.println(jobKey);
        System.out.println("执行时间："+ new Date());
    }
}
